﻿using System;
using System.IO;

namespace MigrationExportService
{
	public static class MigrationUtils
	{
		public static string GetSafeTextFileContents(string filePath)
		{
			string result = String.Empty;

			try
			{
				result = File.ReadAllText(filePath);
			}
			catch (IOException) { }
			catch (System.Security.SecurityException) { }
			catch (UnauthorizedAccessException) { };

			return result;
		}

		public static byte[] GetSafeBinaryFileContents(string filePath)
		{
			byte[] result = null;

			try
			{
				result = File.ReadAllBytes(filePath);
			}
			catch (IOException) { }
			catch (System.Security.SecurityException) { }
			catch (UnauthorizedAccessException) { };

			return result;
		}
	}
}
